#!/usr/bin/env perl
use 5.010;
use strict;

# greet子程序
# 参数：人名 
# 结果：打印欢迎信息,并告诉之前欢迎了那些人
sub greet {
    state @names;

    my $user = shift @_;
    if ( !@names ) {
        print "Hi $user! You are the first one here!\n";
    } else {
        print "Hi $user! I've seen: @names\n";
    }
    push @names, $user;
}

#测试greet子程序
greet("Fred");
greet("Barney");
greet("Wilma");
greet("Betty");
